import { prisma } from '@/lib/prisma/client'
import { NextResponse } from 'next/server'

export async function PUT(
  request: Request,
  { params }: { params: { id: string } }
) {
  try {
    const data = await request.json()
    const group = await prisma.sceneGroup.update({
      where: { id: params.id },
      data
    })
    return NextResponse.json(group)
  } catch (error) {
    return NextResponse.json(
      { error: '更新分组失败' },
      { status: 500 }
    )
  }
}

export async function DELETE(
  request: Request,
  { params }: { params: { id: string } }
) {
  try {
    await prisma.sceneGroup.delete({
      where: { id: params.id }
    })
    return NextResponse.json({ message: '删除成功' })
  } catch (error) {
    return NextResponse.json(
      { error: '删除分组失败' },
      { status: 500 }
    )
  }
} 